﻿$(function () {
    $('.Tab li').hover(function () {
        var ind = $(this).index();
        $(this).addClass('hov').siblings().removeClass('hov');
        $(this).closest('.Tab').next('.TabCont').find('li').eq(ind).show().siblings().hide();
    }, function () {

    });
    // 图层
    function myAlert(imgSrc) {
        if ($('.alertBox').is(':hidden')) {
            $('.fixed').show();
            $('.alertBox .pic').find('img').attr('src', imgSrc);
            $('.alertBox').fadeIn(300);
        }
    };
    //--这种资信-弹出
    $('.qualif li').click(function () {
        var imgSrc = $(this).attr('data-bigimg');
        myAlert(imgSrc);
    });
    //--技术研发-专利-弹出
    //--技术研发-标准-弹出
    $('.patent li').click(function () {
        var imgSrc = $(this).attr('data-bigimg');
        myAlert(imgSrc);
    });
    //--加入我们-员工天地-弹出
    $('.staffWorld li').click(function () {
        var imgSrc = $(this).attr('data-bigimg');
        myAlert(imgSrc);
    });

    $('.alertBox .close').click(function () {
        $('.alertBox').fadeOut(300);
        $('.fixed').hide();
    });



	//--
	$('.bottom .ewm .icons li').hover(function(){
		var ii = $(this).index()+1;
		$(this).find('img').attr('src','/images/c12_'+ ii +'on.png');
	},function(){
		var ii = $(this).index()+1;
		$(this).find('img').attr('src','/images/c12_'+ ii +'.png');
	})
    //--
	$('.sideBar').hover(function () {

	    $('.sideBar .wx').hover(function () {
	        $('.wxBox').show();
	    }, function () {
	        $('.wxBox').hide();
	    });

	    $('.sideBar .phone').hover(function () {
	        $('.phoneBox').show();
	    }, function () {
	        $('.phoneBox').hide();
	    });

	    $('.sideBar .note').hover(function () {
	        $('.noteBox').show();
	    }, function () {
	        $('.noteBox').hide();
	    });

	}, function () {
	    $('.sideBar li').hide();
	    $('.sideBar li').eq(0).show();
	});

	$('.sideBar .contact').hover(function () {
	    $('.sideBar li').show();
	}, function () {

	});


	//--
	$('.sideBar .toTop').click(function(){
		 $('body,html').animate({scrollTop:0},1000);
            return false;
	});
	$('.mToTop').click(function(){
		 $('body,html').animate({scrollTop:0},1000);
            return false;
	});

	//--
	$('.headDiv .search').hover(function(){
		$('.searchBox').show();
	},function(){
		$('.searchBox').hide();
	});
	$('.searchBox').hover(function(){
		$('.searchBox').show();
	},function(){
		$('.searchBox').hide();
	});
	
	//--
	//手风琴
	$('.indBanner3 li').mouseover(function(){
			$(this).parent().find('li').removeClass('curr');
			$(this).addClass('curr');
			$('.curr').stop().animate({
				width: 449
			}, 500, 'linear');
			$('.curr .txt').animate({
				bottom:0
			}, 300, 'linear');
			$('.indBanner3 li').not('.curr').stop().animate({
				width: 149
			}, 500, 'linear');
			$('.indBanner3 li').not('.curr').find('.txt').stop().animate({
				bottom:'-120px'
			}, 300, 'linear');
	});
	//透明蒙层点击,搜索框和菜单栏消失
	//$('.pageBg').click(function(){
	//	$('.searchLayerTel').fadeOut(500);
	//	$('.pageBg').fadeOut(500);
	//})
    //透明蒙层点击,搜索框和菜单栏消失
	$('.pageBg').click(function () {
	    $('.searchLayerTel').fadeOut(500);
	    $('.navLayer').animate({ right: "-100%", width: 0 }, 200);
	    $('.subNav1').siblings(".navContent").slideUp(300);
	    $('.subNav1').removeClass("currentDt");
	    $('.meun-closeBtn').hide();
	    $('.pageBg').fadeOut(500);
	})
	//--手机-搜索按钮
	//--
	$('.headDiv').find('.msearch').click(function(){
		$('.searchLayerTel').fadeIn(500);
		$('.pageBg').fadeIn(500);
	})

	//--手机导航菜单触发
	//$('.navIco a').click(function(){
	//	$('.fn-box>div').hide();
	//	$('.navLayer').show();
	//	$('.navLayer').animate({right: "0",width:"100%"}, 200);
	//	$('.meun-closeBtn').show();
	//	$('.navIco').hide();
	//});

    //--手机导航菜单触发
	$('.navIco a').click(function () {
	    $('.pageBg').fadeIn(500);
	    $('.fn-box>div').hide();
	    $('.navLayer').show();
	    $('.navLayer').animate({ right: "0", width: "100%" }, 200);
	    $('.meun-closeBtn').show();
	    $('.navIco').hide();
	});
	 //--
	$(".subNav1").click(function(){
			$(this).toggleClass("currentDt").siblings(".subNav1").removeClass("currentDt")
			$(this).next(".navContent").slideToggle(300).siblings(".navContent").slideUp(300)
	})
	$('.meun-closeBtn').click(function(){
		$('.navLayer').animate({right: "-100%",width:0}, 200);
		$('.subNav1').siblings(".navContent").slideUp(300);
		$('.subNav1').removeClass("currentDt");
		$('.meun-closeBtn').hide();
	});
		
	// $('.indBanner2 .img').hover(function(){

	// },function(){

	// });

	$(document).ready(function(){})
	var Main = Main || {};
	jQuery(window).load(function() {
		window.responsiveFlag = jQuery('#responsiveFlag').css('display');
		Main.gallery = new Gallery();
		jQuery(window).resize(function() {
			Main.gallery.update();
		});
	});
	function Gallery(){
		var self = this,
			container = jQuery('.flexslider'),
			clone = container.clone( false );
			this.init = function (){
				if( responsiveFlag == 'block' ){
				var slides = container.find('.slides');
				slides.kwicks({
					max : 500,
					spacing : 0
				}).find('li > a').click(function (){
					return false;
				});
				}
			}
			this.update = function () {
				var currentState = jQuery('#responsiveFlag').css('display');
				if(responsiveFlag != currentState) {
					responsiveFlag = currentState;
					container.replaceWith(clone);
					container = clone;
					clone = container.clone( false );
					this.init();
				}
			}
		this.init();
	}
		
	//--导航菜单触发
	$('.sNavA').each(function(i){
		$(this).hover(
		   function(){
		   		var left = $(this).offset().left;
		   		if($(this).index()==1){
		   			$('.sNav ul').eq(i).css('left',left-400);
		   		}else{
			   	$('.sNav ul').eq(i).css('left',left);

		   		}
			   $('.sNav').eq(i).show();
			   $(this).addClass('on2');
			   },
		   function(){
			   $('.sNav').hide();
			   $(this).removeClass('on2');
			   }
		)
		})
	$('.sNav').each(function(i){
		$(this).hover(
		   function(){
		   	   $('.sNavA').eq(i).addClass('on2');
			   $(this).show();
			   },
		   function(){
			   $(this).hide();
			   $('.sNavA').removeClass('on2');
			   }
		)
		})
	//下拉通用
	$('.select').each(function(i){
		function showFn(selectObj) {	//展开效果
			// 把其他的下拉收起
			$('.select').children("dd").slideUp(200);
			selectObj.children("dd").slideDown(200);
		}  
		function hideFn(selectObj){    //关闭效果
			selectObj.children("dd").slideUp(200);
		}
		function hideAll(){
			$('.select dd').slideUp(200);
		};

		$(this).children('dt').click(function(){
			var index = $(this).parent().index();
			// var z = selectObj.css("z-index");
			var selectObj = $(this).parent();
			$(this).next().is(":hidden")?showFn(selectObj):hideFn(selectObj);
		});
		$(this).children('dd').find("li").click(function(){   
			var index = $(this).closest('.select').index();
   			var dataId=$(this).attr('data-id');
			var selectObj = $(this).closest('.select');
			$(this).closest('.select').children("dt").find('a').html($(this).html());
   				$(this).closest('.select').children("dt").find('a').attr('data-id',dataId);
			hideFn(selectObj);
		});
		$("body").click(function(i){ 
			!$(i.target).parents(".select").first().is($(".select")) ? hideAll():"";
		});
	});

});
	
jQuery(document).ready(function($){
	// browser window scroll (in pixels) after which the "back to top" link is shown
	var offset = 300,
		//browser window scroll (in pixels) after which the "back to top" link opacity is reduced
		offset_opacity = 1200,
		//duration of the top scrolling animation (in ms)
		scroll_top_duration = 700,
		//grab the "back to top" link
		$back_to_top = $('.cd-top');

	//hide or show the "back to top" link
	$(window).scroll(function(){
		( $(this).scrollTop() > offset ) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out');
		if( $(this).scrollTop() > offset_opacity ) { 
			$back_to_top.addClass('cd-fade-out');
		}
	});

	//smooth scroll to top
	$back_to_top.on('click', function(event){
		event.preventDefault();
		$('body,html').animate({
			scrollTop: 0 ,
		 	}, scroll_top_duration
		);
	});

});	


function search() {
        var keys = document.getElementById("txtk").value;
        location.href = "/NewsCenter/search.aspx?a=n&keys=" + keys;
    }
    function entersearch() {
        //alert(dd);
        var keys = document.getElementById("txtk").value;
        var event = window.event || arguments.callee.caller.arguments[0];
        if (event.keyCode == 13) {
            //search();
            window.location.href = "/NewsCenter/search.aspx?a=n&keys=" + keys;
            return false;
        }
    }


/****************************/
//----

